package member

import (
	"lao-a/models/member"
	"net/http"
)

// NewCardNum 获取最新卡号
func (c *MemberController) NewCardNum() {
	cardType := c.GetString("cardtype")
	if cardType != member.CARD_PERSONAL && cardType != member.CARD_ENTERPRISE {
		cardType = member.CARD_PERSONAL
	}

	cardNum, err := c.dao.GetNewCardNum(cardType)
	if err != nil {
		c.ResponseJson(err, http.StatusInternalServerError)
	}

	c.ResponseJson(map[string]interface{}{
		"CardNum": cardNum,
	})
}
